def split(str):
    if str.isspace() or str == '':
        return ''
    else:
        l = len(str)
        while str[0] == ' ':
            str = str[1:]
        while str[-1] == ' ':
            str = str[:-1]
        
        return str

str = "   Hel oo    "
print(split(str))